package com.family.service.impl;

import com.family.mapper.RelationshipMapper;
import com.family.mapper.RelationshipStateMapper;
import com.family.model.RelationShipState;
import com.family.model.Relationship;
import com.family.model.User;
import com.family.service.RelationshipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("relationshipService")
public class RelationshipServiceImpl implements RelationshipService {
    private RelationshipMapper relationshipMapper;

    private RelationshipStateMapper relationshipStateMapper;

    @SuppressWarnings("SpringJavaAutowiringInspection")
    @Autowired
    public void setRelationshipMapper(RelationshipMapper relationshipMapper) {
        this.relationshipMapper = relationshipMapper;
    }

    @SuppressWarnings("SpringJavaAutowiringInspection")
    @Autowired
    public void setRelationshipStateMapper(RelationshipStateMapper relationshipStateMapper) {
        this.relationshipStateMapper = relationshipStateMapper;
    }

    @Override
    public int insertRelationship(User user, Relationship... list) {
        return relationshipMapper.insertRelationship(user, list);
    }

    @Override
    public int updateRelationship(User user, Relationship... list) {
        return relationshipMapper.updateRelationship(user, list);
    }

    @Override
    public List<RelationShipState> queryRelationships() {
        return relationshipStateMapper.queryAllStates();
    }

    @Override
    public RelationShipState queryRelationshipById(int shipId) {
        return relationshipStateMapper.queryRelationshipById(shipId);
    }

//    @Override
//    public Relationship insertRelationship(Relationship relationship) {
//        return null;
//    }
}
